<?php
/* 
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
$i=0;
foreach($vouchers as $voucher) {

    $data[$i]["id"] = $voucher->getId();
    $data[$i]["cell"][] = $voucher->getDocSummary();
    $data[$i]["cell"][] = $voucher->getAcctSubject()->getSubjectName();

    if($voucher->getDebitCredit() == 'd') {
        $data[$i]["cell"][] = $voucher->getAmount();
        $data[$i]["cell"][] = '';
    } else {
        $data[$i]["cell"][] = '';
        $data[$i]["cell"][] = $voucher->getAmount();
    }
    
    $i++;
}

echo json_encode($data);

?>
